package org.tagging.service.impl.other;

import org.springframework.stereotype.Service;
import org.tagging.dao.TaggingRoleMapper;
import org.tagging.model.TaggingRole;
import org.tagging.model.TaggingRoleExample;

import javax.annotation.Resource;

@Service
public class RoleServiceImpl {
    @Resource
    private TaggingRoleMapper roleMapper;

    public TaggingRole queryByName(String roleName, TaggingRole.Column... columns) {
        TaggingRoleExample roleExample = new TaggingRoleExample();
        TaggingRoleExample.Criteria criteria = roleExample.createCriteria();
        criteria.andNameEqualTo(roleName);
        return roleMapper.selectOneByExampleSelective(roleExample, columns);
    }

    public TaggingRole queryById(Integer id, TaggingRole.Column... columns) {
        return roleMapper.selectByPrimaryKeySelective(id, columns);
    }
}
